package utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created with IntelliJ IDEA.
 * User: XIAOLIANG
 * Date: 2021/6/17
 * Time: 17:25
 * Description: 此类为连接工厂 创建信道的工具类
 */
public class RabbitmqUtil {

    public static Channel getChannel() throws IOException, TimeoutException {

        ConnectionFactory factory = new ConnectionFactory();

        factory.setHost("119.29.13.67");
        factory.setUsername("admin");
        factory.setPassword("970830");
        Connection connection = factory.newConnection();
        return connection.createChannel();

    }



}